<?php
/**
 * Description of x10_GeneralException
 *
 * @author prometheus
 */
class x10_GeneralException extends Exception
{
	protected $code = 100;
	protected $message = 'Általános kivétel keletkezett: [%1$s]';
	protected $params = array();
	public function  __construct()
	{
		$this->params = func_get_args();
		$this->message = vsprintf($this->format(), $this->params);
	}

	public function format()
	{
		$message = $this->localize();
		return preg_replace(
			array(
				'!\{\"(.*?)\"\}!is',
				'!\[(.*?)\]!is',
				'!\/\"(.*?)\"\/!is',
			),
			array(
				'(<i>&bdquo;$1&rdquo;</i>)',
				'<b>$1</b>',
				'<i>&bdquo;$1&rdquo;</i>',
			),
			$message
		);
	}

	protected function localize()
	{
		$message = $this->message;
		return $message;
	}
}

?>